﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections.Specialized;
using SyCODE.Component.Security;
using SyCODE.Component.DataFactory;
using SyCODE.Component;
using System.Xml;
using System.IO;
using System.Web.Security;

namespace SyCODE.Blog
{
    /// <summary>
    /// 删除选择的个人消息
    /// </summary>
    public class DeleteMessage : IHttpHandler
    {
        #region IHttpHandler 成员

        public bool IsReusable
        {
            get
            {
                return true;
            }
        }

        public void ProcessRequest(HttpContext context)
        {
			Ticket ticket = Ticket.Get(FormsAuthentication.FormsCookieName);
            if (Ticket.Authenticate(ticket))
            {
                NameValueCollection nvc = new NameValueCollection(context.Request.Form);
                nvc.Add("u", ticket.Name);

                DBAM dbam = new DBAM();
                try
                {
                    dbam.BuildParameters("deletemessage", nvc);
                    dbam.Execute();
                }
                finally
                {
                    dbam.Dispose();
                }
            }
            else
            {
                Function.ClientAlert(StringResource.GetField("authfaild"));
            }
        }

        #endregion
    }
}